<!doctype html>
<html lang="{$app->language}">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset={$app->charset}" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<meta name="viewport" content="width=device-width" />
	<meta name="csrf-param" content="{$app->request->csrfParam}">
	<meta name="csrf-token" content="{$app->request->csrfToken}">
	<!--remove underline for edge-->
	<meta name="format-detection" content="telephone=no">
	<meta name="author" content="ShopWind" />
	<meta name="generator" content="ShopWind" />
	<meta name="copyright" content="ShopWind Inc. All Rights Reserved" />
</head>

<body>
	<style type="text/css">
		body {
			background-color: #ededed;
		}
	</style>
	<script type="text/javascript">
		function jsApiCall() {
			WeixinJSBridge.invoke(
				'getBrandWCPayRequest', {$payform.jsApiParameters}, function (res) {
					if (res.err_msg == "get_brand_wcpay_request:ok") {
						// TODO..
					}
					else if (res.err_msg == "get_brand_wcpay_request:cancel") {
						// TODO...
					}
					location.href = "{$payform.orderUrl}";
				}
			);
		}

		function callpay() {
			if (typeof WeixinJSBridge == "undefined") {
				if (document.addEventListener) {
					document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
				} else if (document.attachEvent) {
					document.attachEvent('WeixinJSBridgeReady', jsApiCall);
					document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
				}
			} else {
				jsApiCall();
			}
		}

		callpay();
	</script>
</body>

</html>